//
//  InformationViewController.m
//  18-HomeWork-添加联系人
//
//  Created by dllo on 16/8/5.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "InformationViewController.h"

@interface InformationViewController ()

@end

@implementation InformationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.labelOfName.text = _contact.nameString;
    self.headImageView.image = [UIImage imageNamed:_contact.headImageString];
    self.labelOfPhoneNumber.text = _contact.phoneNumber;
    self.labelOfAddress.text = _contact.addressString;
    NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *avatarsDirectory = [[pathArray firstObject] stringByAppendingPathComponent:@"avatarsDirectory"];
    NSString *imagePath = [avatarsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpg", _contact.nameString]];
    NSData *data = [NSData dataWithContentsOfFile:imagePath];
    UIImage *image = [UIImage imageWithData:data];
    _headImageView.image = image;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
